DESCRIPTION = "Linux kernel for Aspeed"
SECTION = "kernel"
LICENSE = "GPLv2"

PROVIDES += "virtual/kernel"

KCONFIG_MODE="--alldefconfig"
KERNEL_CLASSES ?= "kernel-fitimage"
KERNEL_IMAGETYPE ?= "uImage"
KERNEL_IMAGETYPE_UBOOT ?= "uImage"
KERNEL_IMAGETYPE_DIRECT ?= "uImage"
ARCH ?= "aarch64"


#KSRC ?= "git://github.com/openbmc/linux;protocol=https;branch=${KBRANCH}"
#KSRC ?= "git://github.com/zhangsl-zd/zhangsl-zd;protocol=https;branch=${KBRANCH}"
KSRC ?= "git://git@192.168.0.18/e2000-211-source/linux-ftbmc;protocol=ssh;branch=${KBRANCH}"

SRC_URI = "${KSRC}"
SRC_URI += " file://defconfig"
#SRC_URI += " file://ft2004-devboard-d4-dsk.dts"
#SRC_URI += " file://0001-gd25fl1024-flash-support.patch"

# SRC_URI += " file://0002-fte2000-bugfix.patch"
#SRC_URI += " file://0001-ft2004-make-uImage.patch"
#SRC_URI += " file://ft2004-generic-psci-soc.dtsi"
#SRC_URI += " file://aspeed-bmc-opp-romulus.dts"
#SRC_URI += " file://openbmc-flash-layout.dtsi"
#SRC_URI += " file://aspeed-g5.dtsi"

#FILESEXTRAPATHS:prepend:ft2004 := "${THISDIR}/ft2004:"
FILESEXTRAPATHS:prepend:e2000 := "${THISDIR}/e2000:"

LINUX_VERSION_EXTENSION ?= "-${SRCREV}"

PV = "${LINUX_VERSION}+git${SRCPV}"

inherit kernel
require recipes-kernel/linux/linux-yocto.inc

LINUX_VERSION_EXTENSION ?= "-${SRCREV}"
COMPATIBLE_MACHINE_${MACHINE} = "^${MACHINE}$"

do_patch:append() {
        for DTB in "${KERNEL_DEVICETREE}"; do
               DT=`basename ${DTB} .dtb`
                if [ -r "${WORKDIR}/${DT}.dts" ]; then
                        cp -f ${WORKDIR}/${DT}.dts* \
                                ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/
               fi
       done
#       cp -f ${WORKDIR}/openbmc-flash-layout.dtsi ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/
#       cp -f ${WORKDIR}/aspeed-g5.dtsi ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/
#       cp -f ${WORKDIR}/aspeed-bmc-opp-flash-layout-ubi.dtsi ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/
#       cp -f ${WORKDIR}/ft2004-generic-psci-soc.dtsi  ${STAGING_KERNEL_DIR}/arch/arm64/boot/dts/phytium/
#       cp -f ${WORKDIR}/ft2004-devboard-d4-dsk.dts  ${STAGING_KERNEL_DIR}/arch/arm64/boot/dts/phytium/
}


# From 4.16+ the COPYING file changed
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
